﻿Public Class MenuReportes
    Dim VR As New ReporteadorVP
    Delegate Sub D()
    Private Sub AbreVistaReporte()
        With VR
            .MdiParent = Principal
            .Show()
        End With
    End Sub
  

    Private Sub GeeneraVendidos_Click(sender As Object, e As EventArgs) Handles GeeneraVendidos.Click
        VR = New ReporteadorVP
        With VR
            .Reporte = ReporteadorVP.Reportes.Vendidos
            Dim I, F As String
            I = Me.Dinicialv.Value.Date  'Format(Me.Dinicialv.Value, "yyyy-dd-MM")
            F = Me.Dfinalv.Value.Date  'Format(Me.Dfinalv.Value, "yyyy-dd-MM")
            .Parametros.Add(I)
            .Parametros.Add(F)
            AbreVistaReporte()
            '.Dispose()
        End With
    End Sub

    Private Sub GeneraEjercidos_Click(sender As Object, e As EventArgs) Handles GeneraEjercidos.Click
        VR = New ReporteadorVP
        With VR
            .Reporte = ReporteadorVP.Reportes.Ejercidos
            .Parametros.Add(Me.Diniciale.Value.Date)
            .Parametros.Add(Me.Dfinale.Value.Date)
            AbreVistaReporte()
        End With
    End Sub

    Private Sub GeneraSurtidos_Click(sender As Object, e As EventArgs) Handles GeneraSurtidos.Click
        VR = New ReporteadorVP
        With VR
            .Reporte = ReporteadorVP.Reportes.SurtidoDisponible
            .Parametros.Add(CboCliente.Text)
            AbreVistaReporte()
        End With
    End Sub
    Private Sub BvalesClienteFecha_Click(sender As Object, e As EventArgs) Handles BvalesClienteFecha.Click
        VR = New ReporteadorVP

        With VR
            .Reporte = ReporteadorVP.Reportes.ValesClienteFecha
            .Parametros.Add(Me.DinicialClientesFecha.Value.Date)
            .Parametros.Add(Me.DFinalClientesFecha.Value.Date)
            .Parametros.Add(Me.cbocliente2.Text)
            AbreVistaReporte()
            '.Dispose()
        End With
    End Sub

    Private Sub MenuReportes_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
        Me.Dispose()
    End Sub

    Private Sub MenuReportes_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim CV As DataTable = Me.ClientesConValesTableAdapter.GetData()
        CboCliente.Items.Add("0000" & "|" & "Todos")
        cbocliente2.Items.Add("0000" & "|" & "Todos")
        For Each R As DataRow In CV.Rows
            CboCliente.Items.Add(R("flotilla") & "|" & R("nombre"))
            cbocliente2.Items.Add(R("flotilla") & "|" & R("nombre"))
            Application.DoEvents()
        Next
        CboCliente.Text = "0000|Todos"
        cbocliente2.Text = "0000|Todos"
    End Sub

   

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class